#pragma once

#include "SpriteCanvas.h"
#include "UIListCtrl.h"
#include "UISysCtrl.h"
#include "ScrollNum.h"
// CMatchInfoWnd

enum
{
	Match_Info_Height = 146,
	UserOrder_Height = 72,
	UserList_Height = 165,
};
class CMatchInfoWnd : public CWnd, public CSpriteCanvas, public CUIControl
{
	DECLARE_DYNAMIC(CMatchInfoWnd)

public:
	CMatchInfoWnd();
	virtual ~CMatchInfoWnd();

protected:
	DECLARE_MESSAGE_MAP()

	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
    afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
public:
	void TickUpdate();

	BOOL OnMatchInfo(Msg *pMsg);
	BOOL OnUserOrder(Msg *pMsg);

	virtual void RenderBackground(CDC *pDC);
	virtual void RenderForeground(CDC *pDC);
	virtual void RenderSprite(CDC *pDC);

	void RenderMatchInfo(CDC *pDC);
	void RenderOrder(CDC *pDC);

	void RedrawRect(int nUpdateLayer,CRect rc);
	virtual void InvalidateUI();
	virtual void InvalidateUIRect(CRect rc);

	void PlayScrollNum(int nOldNumber, int nNumber, int nTotalFrame, int nIntervalTime);
	void AddSysText(CString &szText);
public:
	CxImage m_imgBkMatchInfo;
	CxImage m_imgBkOrder;
	CUIListCtrl m_listUser;
	CUISysCtrl  m_ctrlSys;
	CFont m_font;
	
	int m_nPlaceOrder;
	int m_nTotalUserCount;
	CScrollNum m_spPlaceOrder;
	
};

extern CMatchInfoWnd *g_pMatchInfoWnd;

